package main

import (
	"context"
	"fmt"
	"time"

	"go.etcd.io/etcd/client/v3"
)

// Get Catalogue
func main() {

	cfg := clientv3.Config{
		Endpoints: []string{"192.168.0.121:2379"},

		DialTimeout: 5 * time.Second,
	}

	client, err := clientv3.New(cfg)
	if err != nil {
		fmt.Println(err)
		return
	}

	kv := clientv3.NewKV(client)

	kv.Put(context.TODO(), "/cron/jobs/job2", "hello2")

	getResp, err := kv.Get(context.TODO(), "/cron/jobs", clientv3.WithPrefix())
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Println("PreValue", getResp.Kvs)
	}
}
